package com.joysuch.wwyt.bp.controller;

import com.joysuch.wwyt.bp.bean.risk.BpReportSettingBean;
import com.joysuch.wwyt.bp.bean.risk.BpReportSettingDto;
import com.joysuch.wwyt.bp.service.BpReportSettingService;
import com.joysuch.wwyt.core.common.ajax.ResultBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * @Author ZhangDong
 * @Date 2020/3/3 17:08
 */
@RestController
@RequestMapping("/bp/risk/report-setting")
@Api(tags = "/bp/risk/report-setting 风险研判-上报配置")
@CrossOrigin
public class BpRiskReportSettingController {

    @Autowired
    private BpReportSettingService bpReportSettingService;

    @PostMapping("save")
    @RequiresPermissions("bp:risk:report-setting:save")
    @ApiOperation(value = "新建/修改上报配置")
    public ResultBean save(@RequestBody @Valid BpReportSettingBean bpReportSettingBean) {
        return bpReportSettingService.save(bpReportSettingBean);
    }

    @GetMapping("get/{id}")
    @ApiOperation(value = "根据id查询单条数据", response = BpReportSettingDto.class)
    public ResultBean getById(@PathVariable Long id) {
        return bpReportSettingService.getById(id);
    }
}
